/**
 * demo.cpp
 *
 *  Created on: 2014.03.29
 *      Author:
 * Description: 
 */

#define __notcgi

#include "cgi.h"

using namespace cppcgi;

int main(int argc, char **argv)
{
    if (argc < 2)
    {
        cout << "Usage:" << string(argv[0]) << " [file name] [partten] ..." << endl;
        return 0;
    }


    string line;
    File logFile(argv[1]);

//    CRegex* mark = new CRegex[argc - 1];
    string partten;
    if (argv[2])
        partten = string(argv[2]);
    else
        partten = "dap.cgi\\([0-9]+\\) ReadConfigItems:1506] prase received \\[dataitem\\([0-9]{1,2}\\)\\]:MAC=(([a-zA-Z0-9]{2}\\-){5}[0-9a-zA-Z]{2});";
    CRegex mark(partten);
    while (logFile.GetLine(line))
    {
        if (mark.Match(line))
            cout << mark.GetMatchStr(1) << endl;
    }
    return 0;
}